<template>
  <el-text
    :type="type"
    :size="size"
    :truncated="truncated"
    :line-clamp="lineClamp"
    :tag="tag"
  >
    <slot></slot>
  </el-text>
</template>

<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { ElText } from 'element-plus'

export default defineComponent({
  name: 'ElTextWrapper',
  components: {
    ElText
  },
  props: {
    type: {
      type: String as PropType<'primary' | 'success' | 'warning' | 'danger' | 'info'>,
      default: undefined
    },
    size: {
      type: String as PropType<'large' | 'default' | 'small'>,
      default: 'default'
    },
    truncated: {
      type: Boolean,
      default: false
    },
    lineClamp: {
      type: [String, Number] as PropType<string | number>,
      default: undefined
    },
    tag: {
      type: String,
      default: 'span'
    }
  },
  methods: {
    // 提供一个获取文本类型的方法
    getTextType(): string | undefined {
      return this.type
    }
  }
})
</script>

<style scoped>
/* 自定义样式可以在这里添加 */
</style>